{% extends "layouts/base.volt" %}

{% block title %}{{ get_title() }}{% endblock %}
{% block css %}
{{ stylesheet_link('css/pages/faq.css') }}
{% endblock %}
{% block content %}
{% if auth == true %}
	{{ partial("layouts/navbar", ['currentPage': 'index/auth']) }}
	{{ partial("layouts/subnavbar", ['currentPage': 'index/auth']) }}
{% else %}
	{{ partial("layouts/navbar", ['currentPage': 'index']) }}
	{{ partial("layouts/subnavbar", ['currentPage': 'index']) }}
{% endif %}

<div class="main">
	
	<div class="main-inner">

	    <div class="container">
	
    	<div class="row">
    	<div class="span12">
						
				<div class="widget widget-plain">
					
					<div class="widget-content">
						{% if auth == true %}
						<a href="#" class="btn btn-large btn-success btn-support-ask" disabled id="clock">等待</a>
						{% else %}
						<a href="/login" class="btn btn-large btn-success btn-support-ask">登录</a>
						{% endif %}
					</div> <!-- /widget-content -->
						
				</div> <!-- /widget -->
				
				
				
			</div> <!-- /span12 -->
         </div>	
    
	      <div class="row">
	      	
	      	<div class="span12">
	      		
	      		<div class="widget">
						
					<div class="widget-header">
						<i class="icon-pushpin"></i>
						<h3>注意事项</h3>
					</div> <!-- /widget-header -->
					
					<div class="widget-content">
						
						<h3>搜索</h3>
						
						<br />
						
						<ol class="faq-list">
							
							<li>
									<h4>关于比赛开始和结束时间</h4>
									<p>在线测试系统将会在6.30上午9:00开启，将于两个小时后即6.30上午11:00关闭</p>	
									
							</li>
							
						</ol>
						
						
					</div> <!-- /widget-content -->
						
				</div> <!-- /widget -->	
				
		    </div> <!-- /spa12 -->
	      	
	      </div> <!-- /row -->
	
	    </div> <!-- /container -->
    
	</div> <!-- /main-inner -->
	    
</div> <!-- /main -->
    


{% endblock %}
{% block js %}
{{ javascript_include('js/faq.js') }}
<script>

$(function () {
	
	$('.faq-list').goFaq ();

});
$(function(){
  $.get("http://ot.lk-life.com/timer/getBeginTime",{id : 1}, function(result){
    var thetime = parseInt(result);
    var timenow = new Date();

    timenow.setSeconds(timenow.getSeconds() + thetime);
    
    $('#clock').countdown(timenow,function(event){
      var timeformat = event.strftime('距离答题系统开启还有 %D天 %H:%M:%S'); //定义倒计时格式
      $(this).html(timeformat);
    }).on('finish.countdown', function(){ 
    	btn = this;
    	$.get("http://ot.lk-life.com/timer/getEndTime",{id : 1}, function(result){
    		var endtime = parseInt(result);
    		if(endtime < 0){
    			$(btn)
			      .parent()
			      .hide()
			      .html('<a href="#" class="btn btn-large btn-success btn-support-ask" disabled>答题系统已关闭</a>')
			      .addClass('animated flash')
			      .show();
    		}else{
    			$(btn)
			      .parent()
			      .hide()
			      .html('<a href="/answer" class="btn btn-large btn-success btn-support-ask">进入答题系统</a>')
			      .addClass('animated flash')
			      .show();
    		}
    	});
      
    });
  });
});
</script>
{% endblock %}